import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/views/layout/Layout'

/** note: Submenu only appear when children.length>=1
 *  detail see  https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 **/

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    perms: ['GET /aaa','POST /bbb']     will control the page perms (you can set multiple perms)
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    noCache: true                if true ,the page will no be cached(default is false)
  }
**/
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/auth-redirect',
    component: () => import('@/views/login/authredirect'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/errorPage/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/errorPage/401'),
    hidden: true
  },
  {
    path: '',
    component: Layout,
    redirect: 'dashboard',
    children: [
      {
        path: 'dashboard',
        component: () => import('@/views/dashboard/index'),
        name: 'Dashboard',
        meta: { title: '首页', icon: 'dashboard', affix: true }
      }
    ]
  }
]

export const asyncRoutes = [
  {
    path: '/technology-project',
    component: Layout,
    redirect: 'noredirect',
    alwaysShow: true,
    name: 'technologyProject',
    meta: {
      title: '科技业务项目',
      icon: 'project'
    },
    children: [
      {
        path: 'project-manage',
        component: () => import('@/views/technology-project/project-manage'),
        name: 'projectManage',
        meta: {
          perms: ['GET /admin/project/list', 'POST /admin/project/delete', 'POST /admin/project/getAboutResult', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '项目管理',
          noCache: true
        }
      },
      {
        path: 'create',
        component: () => import('@/views/technology-project/project-manage/create'),
        name: 'projectCreate',
        meta: {
          perms: ['POST /admin/project/create', 'POST /admin/storage/upload'],
          title: '新增项目',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'edit',
        component: () => import('@/views/technology-project/project-manage/edit'),
        name: 'projectEdit',
        meta: {
          perms: ['POST /admin/project/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '项目详情',
          noCache: true
        },
        hidden: true
      },
      // {
      //   path: 'project-maintain',
      //   component: () => import('@/views/technology-project/project-maintain'),
      //   name: 'project-maintain',
      //   meta: {
      //     perms: ['GET /admin/collect/list'],
      //     title: '项目维护',
      //     noCache: true
      //   }
      // }
    ]
  },

  {
    path: '/technology-result',
    component: Layout,
    redirect: 'noredirect',
    alwaysShow: true,
    name: 'technologyResult',
    meta: {
      title: '科技业务成果',
      icon: 'result'
    },
    children: [
      {
        path: 'journal-papers',
        component: () => import('@/views/technology-result/journal-papers'),
        name: 'journalPapers',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '期刊论文',
          noCache: true
        }
      },
      {
        path: 'journal-papers-create',
        component: () => import('@/views/technology-result/journal-papers/create'),
        name: 'journal-papers-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增期刊论文',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'journal-papers-edit',
        component: () => import('@/views/technology-result/journal-papers/edit'),
        name: 'journal-papers-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '期刊论文详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'works',
        component: () => import('@/views/technology-result/works'),
        name: 'works',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '论著',
          noCache: true
        }
      },
      {
        path: 'works-create',
        component: () => import('@/views/technology-result/works/create'),
        name: 'works-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增论著',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'works-edit',
        component: () => import('@/views/technology-result/works/edit'),
        name: 'works-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '论著详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'technology-awards',
        component: () => import('@/views/technology-result/technology-awards'),
        name: 'technologyAwards',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '科技奖励',
          noCache: true
        }
      },
      {
        path: 'technology-awards-create',
        component: () => import('@/views/technology-result/technology-awards/create'),
        name: 'technology-awards-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增科技奖励',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'technology-awards-edit',
        component: () => import('@/views/technology-result/technology-awards/edit'),
        name: 'technology-awards-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '科技奖励详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'major',
        component: () => import('@/views/technology-result/major'),
        name: 'major',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '专利',
          noCache: true
        }
      },
      {
        path: 'major-create',
        component: () => import('@/views/technology-result/major/create'),
        name: 'major-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增专利',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'major-edit',
        component: () => import('@/views/technology-result/major/edit'),
        name: 'major-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '专利详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'software',
        component: () => import('@/views/technology-result/software'),
        name: 'software',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '软件著作权',
          noCache: true
        }
      },
      {
        path: 'software-create',
        component: () => import('@/views/technology-result/software/create'),
        name: 'software-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增软件著作权',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'software-edit',
        component: () => import('@/views/technology-result/software/edit'),
        name: 'software-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '软件著作权详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'standard',
        component: () => import('@/views/technology-result/standard'),
        name: 'standard',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '标准',
          noCache: true
        }
      },
      {
        path: 'standard-create',
        component: () => import('@/views/technology-result/standard/create'),
        name: 'standard-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增标准',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'standard-edit',
        component: () => import('@/views/technology-result/standard/edit'),
        name: 'standard-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '标准详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'system-plan-report-programme',
        component: () => import('@/views/technology-result/system-plan-report-programme'),
        name: 'system-plan-report-programme',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '制度/规划/方案/报告等',
          noCache: true
        }
      },
      {
        path: 'system-plan-report-programme-create',
        component: () => import('@/views/technology-result/system-plan-report-programme/create'),
        name: 'system-plan-report-programme-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增制度/规划/方案/报告等',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'system-plan-report-programme-edit',
        component: () => import('@/views/technology-result/system-plan-report-programme/edit'),
        name: 'system-plan-report-programme-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '制度/规划/方案/报告等详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'seismograph',
        component: () => import('@/views/technology-result/seismograph'),
        name: 'seismograph',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '地震仪器样机/软件',
          noCache: true
        }
      },
      {
        path: 'seismograph-create',
        component: () => import('@/views/technology-result/seismograph/create'),
        name: 'seismograph-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增地震仪器样机/软件',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'seismograph-edit',
        component: () => import('@/views/technology-result/seismograph/edit'),
        name: 'seismograph-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '地震仪器样机/软件详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'popular-science',
        component: () => import('@/views/technology-result/popular-science'),
        name: 'popular-science',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '科普作品',
          noCache: true
        }
      },
      {
        path: 'popular-science-create',
        component: () => import('@/views/technology-result/popular-science/create'),
        name: 'popular-science-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增科普作品',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'popular-science-edit',
        component: () => import('@/views/technology-result/popular-science/edit'),
        name: 'popular-science-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '科普作品详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'short-impending',
        component: () => import('@/views/technology-result/short-impending'),
        name: 'short-impending',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '短临预报',
          noCache: true
        }
      },
      {
        path: 'short-impending-create',
        component: () => import('@/views/technology-result/short-impending/create'),
        name: 'short-impending-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增短临预报',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'short-impending-edit',
        component: () => import('@/views/technology-result/short-impending/edit'),
        name: 'short-impending-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '短临预报详情',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'other',
        component: () => import('@/views/technology-result/other'),
        name: 'other',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '其他成果',
          noCache: true
        }
      },
      {
        path: 'other-create',
        component: () => import('@/views/technology-result/other/create'),
        name: 'other-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增其他成果',
          noCache: true
        },
        hidden: true
      },
      {
        path: 'other-edit',
        component: () => import('@/views/technology-result/other/edit'),
        name: 'other-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/storage/upload', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '其他成果详情',
          noCache: true
        },
        hidden: true
      }
    ]
  },
  {
    path: '/field-exploration',
    component: Layout,
    redirect: '/field-exploration',
    children: [
      {
        path: '/field-exploration',
        component: () => import('@/views/field-exploration'),
        name: 'field-exploration',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '野外探测',
          icon: 'field_exploration'
        }
      }
    ]
  },
  {
    path: '/field-exploration-create',
    component: Layout,
    redirect: '/field-exploration-create',
    children: [
      {
        path: '/field-exploration-create',
        component: () => import('@/views/field-exploration/create'),
        name: 'field-exploration-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增野外探测'
        }
      }
    ],
    hidden: true
  },
  {
    path: '/field-exploration-edit',
    component: Layout,
    redirect: '/field-exploration-edit',
    children: [
      {
        path: '/field-exploration-edit',
        component: () => import('@/views/field-exploration/edit'),
        name: 'field-exploration-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/result/upload'],
          title: '野外探测详情'
        }
      }
    ],
    hidden: true
  },
  {
    path: '/field-exploration-result',
    component: Layout,
    redirect: '/field-exploration-result',
    children: [
      {
        path: '/field-exploration-result',
        component: () => import('@/views/field-exploration-result'),
        name: 'field-exploration-result',
        meta: {
          perms: ['GET /admin/result/list', 'POST /admin/result/delete', 'GET /admin/audit/submit', 'GET /admin/audit/pass', 'GET /admin/audit/backup', 'GET /admin/storage/downloadByFileName', 'GET /admin/storage/downloadByFileSaveName/{fileSaveName}'],
          title: '野外工作成果',
          icon: 'result'
        }
      }
    ]
  },
  {
    path: '/field-exploration-result-create',
    component: Layout,
    redirect: '/field-exploration-result-create',
    children: [
      {
        path: '/field-exploration-result-create',
        component: () => import('@/views/field-exploration-result/create'),
        name: 'field-exploration-result-create',
        meta: {
          perms: ['POST /admin/result/create', 'POST /admin/result/upload'],
          title: '新增野外工作成果'
        }
      }
    ],
    hidden: true
  },
  {
    path: '/field-exploration-result-edit',
    component: Layout,
    redirect: '/field-exploration-result-edit',
    children: [
      {
        path: '/field-exploration-result-edit',
        component: () => import('@/views/field-exploration-result/edit'),
        name: 'field-exploration-result-edit',
        meta: {
          perms: ['POST /admin/result/detail', 'POST /admin/result/upload'],
          title: '野外工作成果详情'
        }
      }
    ],
    hidden: true
  },
  {
    path: '/technology-achievements-work',
    component: Layout,
    redirect: '/technology-achievements-work',
    children: [
      {
        path: '/technology-achievements-work',
        component: () => import('@/views/technology-achievements-work'),
        name: 'technology-achievements-work',
        meta: {
          perms: ['GET /admin/result/listPerformance'],
          title: '科技成果转化工作',
          icon: 'technology_work'
        }
      }
    ]
  },
  {
    path: '/technology-achievements-result',
    component: Layout,
    redirect: '/technology-achievements-result',
    children: [
      {
        path: '/technology-achievements-result',
        component: () => import('@/views/technology-achievements-result'),
        name: 'technology-achievements-result',
        meta: {
          perms: ['GET /admin/result/listPerformance'],
          title: '科技成果转化成果',
          icon: 'technology_result'
        }
      }
    ]
  },
  {
    path: '/contribution-query',
    component: Layout,
    redirect: '/contribution-query',
    children: [
      {
        path: '/contribution-query',
        component: () => import('@/views/contribution-query'),
        name: 'contribution-query',
        meta: {
          perms: ['GET /admin/result/listPerformance'],
          title: '贡献查询',
          icon: 'contribution'
        }
      }
    ]
  },
  // {
  //   path: '/goods',
  //   component: Layout,
  //   redirect: 'noredirect',
  //   alwaysShow: true,
  //   name: 'goodsManage',
  //   meta: {
  //     title: '野外探测',
  //     icon: 'chart'
  //   },
  //   children: [
  //     {
  //       path: 'list',
  //       component: () => import('@/views/goods/list'),
  //       name: 'goodsList',
  //       meta: {
  //         perms: ['GET /admin/goods/list', 'POST /admin/goods/delete'],
  //         title: '商品列表',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'create',
  //       component: () => import('@/views/goods/create'),
  //       name: 'goodsCreate',
  //       meta: {
  //         perms: ['POST /admin/goods/create'],
  //         title: '商品上架',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'edit',
  //       component: () => import('@/views/goods/edit'),
  //       name: 'goodsEdit',
  //       meta: {
  //         perms: ['GET /admin/goods/detail', 'POST /admin/goods/update', 'POST /admin/goods/catAndBrand'],
  //         title: '商品编辑',
  //         noCache: true
  //       },
  //       hidden: true
  //     },
  //     {
  //       path: 'comment',
  //       component: () => import('@/views/goods/comment'),
  //       name: 'goodsComment',
  //       meta: {
  //         perms: ['GET /admin/comment/list', 'POST /admin/comment/delete'],
  //         title: '商品评论',
  //         noCache: true
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/store',
  //   component: Layout,
  //   redirect: 'noredirect',
  //   alwaysShow: true,
  //   name: 'storeManage',
  //   meta: {
  //     title: '野外探测成果',
  //     icon: 'chart'
  //   },
  //   children: [
  //     {
  //       path: 'list',
  //       component: () => import('@/views/store/list'),
  //       name: 'storeList',
  //       meta: {
  //         perms: ['GET /admin/store/list', 'POST /admin/store/delete'],
  //         title: '入驻商管理',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'create',
  //       component: () => import('@/views/store/create'),
  //       name: 'storeCreate',
  //       meta: {
  //         perms: ['POST /admin/store/create'],
  //         title: '添加入驻商',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'edit',
  //       component: () => import('@/views/store/edit'),
  //       name: 'storeEdit',
  //       meta: {
  //         perms: ['POST /admin/store/update'],
  //         title: '编辑入驻商',
  //         noCache: true
  //       },
  //       hidden: true // 不显示菜单
  //     }
  //   ]
  // },
  // {
  //   path: '/promotion',
  //   component: Layout,
  //   redirect: 'noredirect',
  //   alwaysShow: true,
  //   name: 'promotionManage',
  //   meta: {
  //     title: '科技成果转化工作',
  //     icon: 'chart'
  //   },
  //   children: [
  //     {
  //       path: 'ad',
  //       component: () => import('@/views/promotion/ad'),
  //       name: 'ad',
  //       meta: {
  //         perms: ['GET /admin/ad/list', 'POST /admin/ad/create', 'GET /admin/ad/read', 'POST /admin/ad/update', 'POST /admin/ad/delete'],
  //         title: '广告管理',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'coupon',
  //       component: () => import('@/views/promotion/coupon'),
  //       name: 'coupon',
  //       meta: {
  //         perms: ['GET /admin/coupon/list', 'POST /admin/coupon/create', 'POST /admin/coupon/update', 'POST /admin/coupon/delete'],
  //         title: '优惠券管理',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'couponDetail',
  //       component: () => import('@/views/promotion/couponDetail'),
  //       name: 'couponDetail',
  //       meta: {
  //         perms: ['GET /admin/coupon/list', 'GET /admin/coupon/listuser'],
  //         title: '优惠券详情',
  //         noCache: true
  //       },
  //       hidden: true
  //     },
  //     {
  //       path: 'topic',
  //       component: () => import('@/views/promotion/topic'),
  //       name: 'topic',
  //       meta: {
  //         perms: ['GET /admin/topic/list', 'POST /admin/topic/create', 'GET /admin/topic/read', 'POST /admin/topic/update', 'POST /admin/topic/delete'],
  //         title: '专题管理',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'topic-create',
  //       component: () => import('@/views/promotion/topicCreate'),
  //       name: 'topicCreate',
  //       meta: {
  //         perms: ['POST /admin/topic/create'],
  //         title: '专题创建',
  //         noCache: true
  //       },
  //       hidden: true
  //     },
  //     {
  //       path: 'topic-edit',
  //       component: () => import('@/views/promotion/topicEdit'),
  //       name: 'topicEdit',
  //       meta: {
  //         perms: ['GET /admin/topic/read', 'POST /admin/topic/update'],
  //         title: '专题编辑',
  //         noCache: true
  //       },
  //       hidden: true
  //     },
  //     {
  //       path: 'groupon-rule',
  //       component: () => import('@/views/promotion/grouponRule'),
  //       name: 'grouponRule',
  //       meta: {
  //         perms: ['GET /admin/groupon/list', 'POST /admin/groupon/create', 'POST /admin/groupon/update', 'POST /admin/groupon/delete'],
  //         title: '团购规则',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'groupon-activity',
  //       component: () => import('@/views/promotion/grouponActivity'),
  //       name: 'grouponActivity',
  //       meta: {
  //         perms: ['GET /admin/groupon/listRecord'],
  //         title: '团购活动',
  //         noCache: true
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/config',
  //   component: Layout,
  //   redirect: 'noredirect',
  //   alwaysShow: true,
  //   name: 'configManage',
  //   meta: {
  //     title: '科技成果转化成果',
  //     icon: 'chart'
  //   },
  //   children: [
  //     {
  //       path: 'mall',
  //       component: () => import('@/views/config/mall'),
  //       name: 'configMall',
  //       meta: {
  //         perms: ['GET /admin/config/mall', 'POST /admin/config/mall'],
  //         title: '商场配置',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'express',
  //       component: () => import('@/views/config/express'),
  //       name: 'configExpress',
  //       meta: {
  //         perms: ['GET /admin/config/express', 'POST /admin/config/express'],
  //         title: '运费配置',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'order',
  //       component: () => import('@/views/config/order'),
  //       name: 'configOrder',
  //       meta: {
  //         perms: ['GET /admin/config/order', 'POST /admin/config/order'],
  //         title: '订单配置',
  //         noCache: true
  //       }
  //     },
  //     {
  //       path: 'wx',
  //       component: () => import('@/views/config/wx'),
  //       name: 'configWx',
  //       meta: {
  //         perms: ['GET /admin/config/wx', 'POST /admin/config/wx'],
  //         title: '小程序配置',
  //         noCache: true
  //       }
  //     }
  //   ]
  // },
  {
    path: '/sys',
    component: Layout,
    redirect: 'noredirect',
    alwaysShow: true,
    name: 'sysManage',
    meta: {
      title: '系统管理',
      icon: 'system'
    },
    children: [
      {
        path: 'admin',
        component: () => import('@/views/sys/admin'),
        name: 'admin',
        meta: {
          perms: ['GET /admin/admin/list', 'POST /admin/admin/create', 'POST /admin/admin/update', 'POST /admin/admin/delete'],
          title: '管理员',
          noCache: true
        }
      },
      {
        path: 'notice',
        component: () => import('@/views/sys/notice'),
        name: 'sysNotice',
        meta: {
          perms: ['GET /admin/notice/list', 'POST /admin/notice/create', 'POST /admin/notice/update', 'POST /admin/notice/delete'],
          title: '通知管理',
          noCache: true
        }
      },
      {
        path: 'log',
        component: () => import('@/views/sys/log'),
        name: 'log',
        meta: {
          perms: ['GET /admin/log/list'],
          title: '操作日志',
          noCache: true
        }
      },
      {
        path: 'role',
        component: () => import('@/views/sys/role'),
        name: 'role',
        meta: {
          perms: ['GET /admin/role/list', 'POST /admin/role/create', 'POST /admin/role/update', 'POST /admin/role/delete', 'GET /admin/role/permissions', 'POST /admin/role/permissions'],
          title: '角色管理',
          noCache: true
        }
      },
      {
        path: 'os',
        component: () => import('@/views/sys/os'),
        name: 'os',
        meta: {
          perms: ['GET /admin/storage/list', 'POST /admin/storage/create', 'POST /admin/storage/update', 'POST /admin/storage/delete'],
          title: '对象存储',
          noCache: true
        }
      }
    ]
  },
  {
    path: '/profile',
    component: Layout,
    redirect: 'noredirect',
    alwaysShow: true,
    children: [
      {
        path: 'password',
        component: () => import('@/views/profile/password'),
        name: 'password',
        meta: { title: '修改密码', noCache: true }
      },
      {
        path: 'notice',
        component: () => import('@/views/profile/notice'),
        name: 'notice',
        meta: { title: '通知中心', noCache: true }
      }
    ],
    hidden: true
  },

  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter () {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
